<template>
  <div class="home">
    <!-- 搜索框 -->
    <Tittle></Tittle>
    <!-- 商品列表 -->
    <div
      class="shop"
      v-for="(item, index) in list"
      :key="index"
      @click="Detail(item)"
    >
      <div class="img">
        <img :src="item.picUrl" alt="" />
      </div>
      <div class="nr">
        <div class="name">{{ item.name }}</div>
        <div class="xing">
          <span>{{ item.wmPoiScore / 10 }}</span>
          <span>{{ item.monthSalesTip }}</span>
        </div>
        <div class="ps">
          <span>{{ item.minPriceTip }}</span>
          <span>{{ item.shippingFeeTip }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { shop_list } from "../../utils/api";
import Tittle from "../../components/Tittle.vue";
export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    shop_list().then((res) => {
      // console.log(res.data);
      this.list = res.data.list;
    });
  },
  methods: {
    Detail(item) {
      this.$router.push("/detail/" + item.mtWmPoiId);
    },
  },
  components: {
    Tittle,
  },
};
</script>

<style lang='scss' scoped>
.shop {
  padding: 10px;
  display: flex;
  .img {
    width: 100px;
    margin-right: 10px;
    img {
      width: 100%;
    }
  }
  .nr {
    flex: 1;
    .name {
      font-weight: bold;
    }
    .xing {
      padding: 4px 0;
      span {
        padding-right: 10px;
      }
    }
    .ps {
      padding: 4px 0;
      span {
        padding-right: 10px;
      }
    }
  }
}
</style>